Users
Introduction
The Users API offers tools for managing user accounts on your platform. It includes functionality for creating, updating, deactivating, and reactivating users, as well as managing user sessions and permissions. This documentation will assist you in maintaining a robust user management system, ensuring secure and efficient access to your platform's resources.
info
Make sure you generated the api_token on your store. More info HERE
Endpoints |
---|
Create |
Update |
Deactivate |
Reactivate |
Force Logout |
Create
POST /integration-api/v1/dashboard/users/
Request Body
Parameter | Type | Description |
---|---|---|
external_id | string | Required |
string | Required | |
new_password | string | Recommended |
sessions_limit | integer | |
assign_new_plan | integer | |
new_plan_custom_valid_to | string | |
admin | boolean | |
plan_admin | boolean | |
only_sees_readable | boolean |
{
"email":"[email protected]",
"external_id":"user-id-in-your-platform",
"new_password":"Abcd1234",
"sessions_limit":null, //if you need to limit the simultaneous user sessions, here you must enter an integer no greater than 999999
"assign_new_plan": null, //if you need to assign a plan, you must enter the plan_id here
"new_plan_custom_valid_to":"", //Accepted date format: yyyy-mm-dd
"admin":false,
"plan_admin":false,
"only_sees_readable":true,
}
Response
Code | Description |
---|---|
200 | Object Created |
422 | Validation error, the reason of the error will be described in the response body |
401 | Unauthenticated |
{
"CODE": "success",
"data": {
"id": 923242,
"email": "[email protected]",
"uuid": "af5af4f9-9b8d-4d79-b162-0cec4279cae5",
"picture": "https://www.gravatar.com/avatar/5c472faa5105266a3d41aee277eb9d0c?s=160&d=mm&r=g",
"admin": false,
"plan_admin": false,
"only_sees_readable": false,
"sessions_limit": null,
"created_at": {
"timestamp": 1620931649,
"date": "2021-05-13 18:47:29",
"timezone": "UTC"
},
"updated_at": {
"timestamp": 1621256387,
"date": "2021-05-17 12:59:47",
"timezone": "UTC"
},
"deleted_at": null
}
}
Retrieve
GET /integration-api/v1/dashboard/users
Query Parameters
tip
Using query parameter you can filter by email
, deactivated
and admins
users
Parameter | Type | Example |
---|---|---|
email | string | /integration-api/v1/dashboard/users/[email protected] |
deactivated | integer | /integration-api/v1/dashboard/users/?query=deactivated |
admins | integer | /integration-api/v1/dashboard/users/?query=admins |
Response
Code | Description |
---|---|
200 | Success |
404 | Object not found |
401 | Unauthenticated |
Example
{
"CODE": "success",
"data": {
"paginator": {
"current_page": 1,
"data": [
{
"id": 923242,
"uuid": "af5af4f9-9b8d-4d79-b162-0cec4279cae5",
"admin": false,
"plan_admin": false,
"email": "[email protected]",
"sessions_limit": 1,
"only_sees_readable": 1,
"picture": "https://www.gravatar.com/avatar/98789c9d5825d6f6c6615313ffcaf1ac?s=160&d=mm&r=g",
"created_at": "2021-05-18T13:28:53.000000Z",
"updated_at": "2021-05-18T13:28:53.000000Z",
"deleted_at": null,
"purchased_issues_with_cancelled_count": 0,
"user_plans_count": 0,
"can_be_edited": true,
"created_at_date_string": "2021-05-18",
"impersonate": "https://example.publica.la/impersonate/take/53114",
"sessions": null,
"ip_ranges": [],
"referrers": [],
"purchased_issues_with_cancelled": [],
"user_plans": []
},
{
...
}]
}
}
}
Update
PUT /integration-api/v1/dashboard/users/{user_id}
Request Body
Parameter | Type | Description |
---|---|---|
external_id | string | Required |
string | Required | |
new_password | string | Recommended |
sessions_limit | integer | |
assign_new_plan | integer | |
new_plan_custom_valid_to | string | |
admin | boolean | 1 or 0 |
plan_admin | boolean | 1 or 0 |
only_sees_readable | boolean | Required 1 or 0 |
user_plan_name |
Response
Code | Description |
---|---|
204 | Object Updated |
422 | Validation error, the reason of the error will be described in the response body |
401 | Unauthenticated |
Deactivate
IMPORTANT NOTE
This endpoint enables you to deactivate an user. A deactivated user can not log in through any means.
DELETE /integration-api/v1/dashboard/users/{id}
Parameter | Type | Example |
---|---|---|
id | integer | /integration-api/v1/dashboard/users/923242 |
Response
Code | Description |
---|---|
200 | Object deleted |
404 | Object not found |
401 | Unauthenticated |
{
"CODE": "success",
"data": []
}
Reactivate
PUT /integration-api/v1/dashboard/users/{user_id}/re-activate
Parameter | Type | Example |
---|---|---|
id | integer | /integration-api/v1/dashboard/users/923242/re-activate |
Response
Code | Description |
---|---|
200 | Object deleted |
404 | Object not found |
401 | Unauthenticated |
{
"CODE": "success",
"data": 1
}
Force Logout
POST /integration-api/v1/users/{user_id}/force-logout
Parameter | Type | Example |
---|---|---|
id | integer | /integration-api/v1/dashboard/users/923242/force-logout |
important
After logging out, the user will be redirected to the initial URL on its next interaction with the system.
The endpoint receives as user identifier the ID or the external_id. Keep in mind that in the case the external-auth-token
is used then the external_id is the UUID contained in the token.